package com.xiaocao.daoimpl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.xiaocao.beans.UserInfo;
import com.xiaocao.dao.IUserInfoDao;

public class UserInfoDaoImpl extends HibernateDaoSupport implements IUserInfoDao{

	@Override
	public UserInfo getUser(String name) {
		getHibernateTemplate().setCacheQueries(true);
		List<Object> result = null;
		UserInfo user=null;
		String hql = "from UserInfo where username =?";
		result = getHibernateTemplate().find(hql, name);
		if (null != result && result.size() > 0) {
			user=(UserInfo)result.get(0);
		}
		return user;
	}

}
